package com.swanclouds.redfish.managers.domain;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.managers.Kvm;

import java.util.Map;

public class KvmServiceModel implements Kvm {
    //KVM服务实例信息的访问路径
    @JsonProperty("@odata.id")
    private String dataId;

    //KVM服务实例信息的OData描述信息
    @JsonProperty("@odata.context")

    private String context;
    //KVM服务实例信息的类型
    @JsonProperty("@odata.type")
    private String type;

    //KVM服务实例信息的ID
    @JsonProperty("Id")
    private String id;

    //KVM服务实例信息的名称
    @JsonProperty("Name")
    private String name;

    //KVM服务实例信息的描述
    @JsonProperty("Description")
    private String description;

    /**
     * KVM License状态，
     * true：ok
     * false：存在问题
     */
    @JsonProperty("LicenseStatus")
    private Boolean licenseStatus;

    /**
     * 服务是否使能
     * true：使能
     * false：禁用
     */
    @JsonProperty("ServiceEnabled")
    private Boolean serviceEnabled;

    /**
     * 是否加密
     * true：加密
     * false：不加密
     */
    @JsonProperty("EncryptionEnabled")
    private Boolean encryptionEnabled;

    //KVM访问端口号
    @JsonProperty("KvmPort")
    private Integer kvmPort;

    /**
     * 鼠标模式
     * “absolute”：绝对位置模式（windows）
     * “relative”：相对位置模式（linux）
     * “other”：其它模式
     */
    @JsonProperty("MouseMode")
    private String mouseMode;

    //H5 Web端口
    @JsonProperty("WebPort")
    private Integer webPort;

    /**
     * 单端口状态
     * true：不加密模式访问
     * false：加密模式访问
     * 当SingleportStatus为true时，EncryptionEnabled为false
     */
    @JsonProperty("SingleportStatus")
    private Boolean singleportStatus;

    //KVM窗口自适应纵横比
    @JsonProperty("AspectRatio")
    private Integer aspectRatio;

    /**
     * 服务器监控OFF功能状态
     * true：监控
     * false：不监控
     */
    @JsonProperty("MonitorHostOffEnabled")
    private Boolean monitorHostOffEnabled;

    /**
     * 当KVM启动时自动OFF服务器监控
     * true：不再监控
     * false：监控
     */
    @JsonProperty("AutoOffHostMonitor")
    private Boolean autoOffHostMonitor;

    //KVM最大会话数
    @JsonProperty("MaximumNumberOfSessions")
    private Integer maximumNumberOfSessions;

    //KVM当前会话数
    @JsonProperty("NumberOfActivatedSessions")
    private String numberOfActivatedSessions;

    //虚拟键盘、鼠标持续连接使能
    @JsonProperty("PersistentUSBConnectionEnabled")
    private String persistentUSBConnectionEnabled;
    //会话超时时间
    @JsonProperty("SessionTimeoutMinutes")
    private String sessionTimeoutMinutes;

    @JsonProperty("RetryInterval")
    private Integer retryInterval;

    @JsonProperty("Actions")
    private Map<String,Object> actions;

    @JsonProperty("Url")
    private Map<String,Object> url;


    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    public String getDescription() {
        return description;
    }

    public Boolean getLicenseStatus() {
        return licenseStatus;
    }

    public Boolean getServiceEnabled() {
        return serviceEnabled;
    }

    public Boolean getEncryptionEnabled() {
        return encryptionEnabled;
    }

    public Integer getKvmPort() {
        return kvmPort;
    }

    public String getMouseMode() {
        return mouseMode;
    }

    public Integer getWebPort() {
        return webPort;
    }

    public Boolean getSingleportStatus() {
        return singleportStatus;
    }

    @Override
    public Integer getRetryCount() {
        return null;
    }

    @Override
    public Integer getRetryInterval() {
        return this.retryInterval;
    }

    public Integer getAspectRatio() {
        return aspectRatio;
    }

    @Override
    public String getKeyboardLayout() {
        return null;
    }

    public Boolean getMonitorHostOffEnabled() {
        return monitorHostOffEnabled;
    }

    public Boolean getAutoOffHostMonitor() {
        return autoOffHostMonitor;
    }

    public Integer getMaximumNumberOfSessions() {
        return maximumNumberOfSessions;
    }

    public String getNumberOfActivatedSessions() {
        return numberOfActivatedSessions;
    }

    public String getPersistentUSBConnectionEnabled() {
        return persistentUSBConnectionEnabled;
    }

    public String getSessionTimeoutMinutes() {
        return sessionTimeoutMinutes;
    }

    @Override
    public Map<String, Object> getActions() {
        return this.actions;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "KvmServiceModel{" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", licenseStatus=" + licenseStatus +
                ", serviceEnabled=" + serviceEnabled +
                ", encryptionEnabled=" + encryptionEnabled +
                ", kvmPort=" + kvmPort +
                ", mouseMode='" + mouseMode + '\'' +
                ", webPort=" + webPort +
                ", singleportStatus=" + singleportStatus +
                ", aspectRatio=" + aspectRatio +
                ", monitorHostOffEnabled=" + monitorHostOffEnabled +
                ", autoOffHostMonitor=" + autoOffHostMonitor +
                ", maximumNumberOfSessions=" + maximumNumberOfSessions +
                ", numberOfActivatedSessions='" + numberOfActivatedSessions + '\'' +
                ", persistentUSBConnectionEnabled='" + persistentUSBConnectionEnabled + '\'' +
                ", sessionTimeoutMinutes='" + sessionTimeoutMinutes + '\'' +
                ", retryInterval=" + retryInterval +
                ", actions=" + actions +
                ", url=" + url +
                '}';
    }
}
